import asyncio

async def main():
    from services.automatic_control.handler import AutomaticControlHandler

    loop = asyncio.get_event_loop()

    handler = AutomaticControlHandler()
    loop.create_task(handler.model.loop())
    loop.create_task(handler.model.rx_rm_watch())
    loop.create_task(handler.model.rx_services_loop())
    loop.create_task(handler.model.tx_service_loop())
    loop.create_task(handler.model.tx_service_gsm_loop())
    loop.create_task(handler.model.adjustment_loop())
    loop.create_task(handler.model.carrier_frequency_control_loop())
    # loop.create_task(handler.model.carrier_frequency_log_loop())
    loop.create_task(handler.model.rx_control_loop())
    loop.create_task(handler.model.ocb_loop())
    # loop.create_task(handler.model.cmg_noise())
    await handler.receive_messages(loop)


if __name__ == '__main__':
    asyncio.new_event_loop()\
        .run_until_complete(main())

